package com.example.myapplication;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MyFragment extends Fragment {
    private TextView mTv;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_test,container,false);
        initViews( v);
        return v;
    }

    private void initViews(View view) {
        mTv = view.findViewById(R.id.tv);
        Bundle bundle = getArguments();
        if (bundle != null){
            String i = bundle.getString("key");
            mTv.setText("tab"+i);
        }
    }
}
